<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <head>
<!--

-->
    <title>3D coastline</title>
    <!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** -->
    <script src="http://www.google.com/jsapi?key=ABQIAAAAQSoN48j7rjZcIIA_ZoGJSRQ_2OOd3pJr2kTduwgeopUaa7SGeRQZhFrOA51woHTuA4Pf0Gm4ZMKzVA"></script>
	
    <script>
	
google.load("earth", "1");

var panoramiobf = 'http://www.panoramio.com/panoramio.kml?';
var pangiga = 'http://mw2.google.com/mw-earth-vectordb/gallery_website/en/Gigapan_Photos.kml';
var panocities = 'http://mw1.google.com/mw-earth-vectordb/dynamic/360cities/1/en/root.kmz';
var panowwp = 'http://www.worldwidepanorama.org/worldwidepanorama/wwp_all/all_of_wwp.kmz';
var panoviewat = 'http://services.google.com/earth/kmz/view_at_n.kmz';
var povertrlag = 'https://sites.google.com/site/3dcoastliner/globus/treta-laguna/%D0%A2%D1%80%D0%B5%D1%82%D1%8C%D1%8F%D0%BB%D0%B0%D0%B3%D1%83%D0%BD%D0%B0.kmz';
var poveraya = 'https://sites.google.com/site/3dcoastliner/globus/mys-aja/3-hr.kml';
var poveraya1 = 'https://sites.google.com/site/3dcoastliner/globus/mys-aja/P1010047.kml';

var myGE = null;

var currentKmlObjects = {
    'panoramiobf': null,
	'pangiga': null,
	'panocities': null,
    'panowwp': null,
    'panoviewat': null
  };

function init() {
  google.earth.createInstance("map3d", initCallback, failureCallback);
 }

function initCallback(object) {
  myGE = object;
  myGE.getWindow().setVisibility(true);
  myGE.getNavigationControl().setVisibility(myGE.VISIBILITY_AUTO);
  myGE.getNavigationControl().setStreetViewEnabled(true);
  myGE.getLayerRoot().enableLayerById(myGE.LAYER_BUILDINGS, true);
  myGE.getLayerRoot().enableLayerById(myGE.LAYER_BORDERS, true);
  
  f_pano = getNL(poveraya);  f_pano.setVisibility(true);
  f_pano = getNL(poveraya1);  f_pano.setVisibility(true);
  //f_pano = getNL(panocities);  f_pano.setVisibility(true);
  //f_pano = getNL(panowwp);  f_pano.setVisibility(true);
  //f_pano = getNL(panoviewat);  f_pano.setVisibility(true);
  f_pano = getNL(povertrlag);  f_pano.setVisibility(true);
  
  fly2aya();
  
  // if the page loaded with checkboxes checked, load the appropriate
    // KML files
    if (document.getElementById('kml-panocities-check').checked)
      loadKml('panocities');
    
    if (document.getElementById('kml-panowwp-check').checked)
      loadKml('panowwp');
    
    if (document.getElementById('kml-panoviewat-check').checked)
      loadKml('panoviewat');
	  
	if (document.getElementById('kml-panoramiobf-check').checked)
      loadKml('panoramiobf');
	
	if (document.getElementById('kml-pangiga-check').checked)
      loadKml('pangiga'); 
}  
 
 function failureCallback(object) {
}

function getNL(kmlURL){
  var nl = myGE.createNetworkLink("");
  var link = myGE.createLink("");
  link.setHref(kmlURL);
  nl.setLink(link);
  myGE.getGlobe().getFeatures().appendChild(nl);
  return nl;
}

function fly2aya() {
  go(44.429800,33.651809,0,1436.78,10.52,61.40); 
}

function fly2fio() {
  go(44.49989811,33.49519717,200,120,2,70); 
} 
 
 function fly2trl() {
		go(44.73362259905476,37.42945157058471,11.88999999797014,60,-90.10515554611744,81.92955487847084); 
 }

function go(lat,lon,alt,range,heading,tilt){
        var la = myGE.createLookAt('');     
        la.set(lat, lon, alt, myGE.ALTITUDE_RELATIVE_TO_GROUND, heading,tilt,range);
        myGE.getView().setAbstractView(la);
}
function toggleKml(file) {
    // remove the old KML object if it exists
    if (currentKmlObjects[file]) {
      myGE.getFeatures().removeChild(currentKmlObjects[file]);
      currentKmlObject = null;
    }
    
    // if the checkbox is checked, fetch the KML and show it on Earth
    var kmlCheckbox = document.getElementById('kml-' + file + '-check');
    if (kmlCheckbox.checked)
      loadKml(file);
  }
  
  function loadKml(file) {
    var kmlUrl = null;
	if (file == 'panoramiobf') kmlUrl = panoramiobf ;
	if (file == 'pangiga') kmlUrl = pangiga ;
	if (file == 'panocities') kmlUrl = panocities ;
	if (file == 'panowwp') kmlUrl = panowwp ;
	if (file == 'panoviewat') kmlUrl = panoviewat ;
	
	    // fetch the KML
    google.earth.fetchKml(myGE, kmlUrl, function(kmlObject) {
      // NOTE: we still have access to the 'file' variable (via JS closures)
      
      if (kmlObject) {
        // show it on Earth
        currentKmlObjects[file] = kmlObject;
        myGE.getFeatures().appendChild(kmlObject);
      } else {
        // bad KML
        currentKmlObjects[file] = null;
  
        // wrap alerts in API callbacks and event handlers
        // in a setTimeout to prevent deadlock in some browsers
        setTimeout(function() {
          alert('Bad or null KML.');
        }, 0);
        
        // uncheck the box
        document.getElementById('kml-' + file + '-check').checked = '';
      }
    });
  }	
	</script>
  </head>
  <body onload='init()' id='body'>
     <center>
      <div id='map3d' style='border: 1px solid silver; height: 500px; width: 100%;'></div>
<!--	  
	 
-->	
<div style="text-align:left">
<font face="verdana, sans-serif" size="1">
Карта показывает слои кликабельных панорам, перечисленные ниже, панорамы Street View, 3D-объекты и висящие в воздухе кликабельные Photo Overlay-фотографии  
<a href="javascript:go(44.73362259905476,37.42945157058471,11.88999999797014,25,-90.10515554611744,81.92955487847084);">Третья лагуна</a>
 и <a href="javascript:go(44.429800,33.651809,0,1436.78,10.52,61.40);">Затерянный мир</a>. 
</font>
</div> 	
<br>
<div style="text-align:left">
<font face="verdana, sans-serif" size="2">Уровни (слои) представления изображений берегов:<br>
<br>
Слой 1. Последовательность фотографий и некруговых панорам (аналог 
<input type="checkbox" id="kml-panoramiobf-check" onclick="toggleKml('panoramiobf');">
<label for="kml-panoramiobf-check">Panoramio</label> и 
<input type="checkbox" id="kml-pangiga-check" onclick="toggleKml('pangiga');">
<label for="kml-pangiga-check">Gigapan</label>), но привязанных к Глобусу в соответствии с ракурсом съёмки.<br>
Слой 2. Последовательность круговых фотопанорам (аналог Street View, 
<input type="checkbox" checked id="kml-panocities-check" onclick="toggleKml('panocities');">
<label for="kml-panocities-check">360 Cities</label>, 
<input type="checkbox" id="kml-panowwp-check" onclick="toggleKml('panowwp');">
<label for="kml-panowwp-check">World Wide Panoramas</label> (<a href="javascript:go(44.49989811,33.49519717,200,120,2,70);">мыс Фиолент</a>), 
<input type="checkbox" id="kml-panoviewat-check" onclick="toggleKml('panoviewat');">
<label for="kml-panoviewat-check">ViewAt</label> (<a href="javascript:go(44.760871,37.37971,50,5000,0,75);">Утриш</a>) и др.).<br>
Слой 3. Последовательность стереопанорам (или 3D-фотографий или, может в будущем, каких-нибудь голограмм).<br>
Слой 4. Реалистичная виртуальная 3D-модель берега на основе лазерного сканирования (аналог 3D Warehouse - на  карте вверху см. 
3D-модели скал <a href="javascript:go(44.49904723,33.50834128,150,50,0,60);">Св.Явления</a>, <a href="javascript:go(44.43753736,38.18510775,48.43,200,0,74.999);">Парус</a>).<br>
Слой 5. Подводное изображение прибрежной полосы. 
</font>
</div>
</body>
</html>
